package io.github.weiranyi.controller;

import io.github.weiranyi.pojo.Product;
import io.github.weiranyi.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private ProductService productService;

    /**
     * 1. http://localhost:9000/product/query/1
     * @param id
     * @return
     */
    @RequestMapping("/query/{id}")
    public Product query(@PathVariable Integer id){
        return productService.findById(id);
    }
}
